//@author A0080442N
#pragma once
#ifndef QUICKADDSTRINGPARSER_H_
#define QUICKADDSTRINGPARSER_H_

#include "TaskItGlobal.h"
#include "Date.h"

//QuickAddStringParser is a supporting string parser class which supports the quick add
//feature of a programme. Users are able to add a task which contains activity only, or a task
//which contains activity and date only. This class facilitates the analysing of the string for
//that purpose.
class QuickAddStringParser {
private:
	vector <string> _splitString;

public:
	QuickAddStringParser();

	//This function will split the whole user input word by word. Each word will be
	//stored inside the vector _splitString. The function will return the _returnString
	//vector after analysing the user input.
	//Pre-Req: A string containing the userInput.
	//Post-Req: Each word in the user input will be stored inside _splitString and _returnString
	//will be returned after analysing the user input.
	void parseString(string userInput, string &activity, string &date);
	//Given that the userInput has already been parsed, this function will analyse the 
	//user input word by word to determine the activity and whether there is a date/day present.
	//Pre-Req: User input has already been parsed.
	//Post-Req: Push back the information for activity and date to _returnString.
	void analyseString(string &activity, string &date);

	//Facilitates the checking of validity of a day when the keyword "this or "next" is found
	//in _splitString. Returns true if the next keyword refers to a day (e.g. Wednesday) and
	//the date string will be modified to reference to the date specified by the user.
	//Pre-Req: The current keyword ("this" or "next"), the next keyword and a date string.
	//Post-Req: Returns true if a valid day is specified by user and date will be modified 
	//			accordingly.
	bool setDateForThisOrNext(string keyword, string nextKeyword, string &date);
	//Facilitates the checking of validity of a day/date when the keyword "on" is found
	//in _splitString. Returns true if the next keyword refers to a day/date and
	//the date string will be modified to reference to the date specified by the user.
	//Pre-Req: The next keyword after "on" and a date string.
	//Post-Req: Returns true if a valid day/date is specified by user and date will be modified 
	//			accordingly.
	bool setDateForOn(string nextKeyword, string &date);

	//Checks whether a given word is a keyword. Keywords are "Today", "Tomorrow", "This", "Next", "On"
	//and their respective short forms
	//Pre-Req: A single word as a string type.
	//Post-Req: Returns true if it is a keyword and false otherwise.
	bool isKeyword(string keyword);
	//Checks whether a given word is a day keyword. Day Keywords are "Monday", "Tuesday", "Wednesday",
	//"Thursday", "Friday", "Saturday", "Sunday", "Today", "Tomorrow" and their respective short forms.
	//Pre-Req: A single word as a string type.
	//Post-Req: Returns true if it is a Day Keyword and false otherwise.
	bool isDayKeyword(string keyword);

	//This function returns a string that represents today's
	//date on the local computer in the format DDMMYY.
	//Pre-Req: None.
	//Post-Req: Returns a string that contains today's date in the format DDMMYY.
	string setDateForToday();
	//This function returns a string that represents tomorrow's
	//date on the local computer in the format DDMMYY.
	//Pre-Req: None.
	//Post-Req: Returns a string that contains tomorrow's date in the format DDMMYY.
	string setDateForTomorrow();

	//Given a current activity string and a keyword to be added, this function appends
	//that keyword to the activity string with a spacing.
	//Pre-Req: Original activity string and keyword to be added.
	//Post-Req: Activity string will be modified with the keyword appended behind after a spacing.
	void appendToActivity(string &activity, string keyword);
};

#endif

